package cn.tedu;

import java.io.*;

/*本类用于写字节输入流*/
public class TestInput1 {
    public static void main(String[] args) {
//        manod();//输出InputStream字节流
        manod1();//输出BufferedInputStream字节流
    }

    private static void manod1() {
//        InputStream in = new BufferedInputStream(new FileInputStream("D:\\ready\\1.txt"));
        InputStream in = null;
        try {
            in = new BufferedInputStream(new FileInputStream(new File("D:\\ready\\1.txt")));
            int a;
            while ((a=in.read())!=-1){
                System.out.println(a);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }finally {
            try {
                in.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

    private static void manod() {
//        InputStream in1 = new FileInputStream(new File("D:\\ready\\1.txt"));
        InputStream in = null;
        try {
            in = new FileInputStream("D:\\ready\\1.txt");
            int b;
            while ((b=in.read())!=-1){
                System.out.println(b);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }finally {
            try {
                in.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}
